package com.kexio.user.entity;

import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kexio.common.entity.BaseEntity;

/**
 * 部门信息实体
 * 
 * 对应数据库表 sys_dept
 * 存储组织架构的部门信息
 * 
 * @author kexio
 * @since 1.0.0
 */
@TableName("sys_dept")
public class Dept extends BaseEntity {
    
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    
    /**
     * 父部门ID
     */
    @TableField("parent_id")
    private String parentId;
    
    /**
     * 部门名称
     */
    @TableField("dept_name")
    private String deptName;
    
    /**
     * 部门编码
     */
    @TableField("dept_code")
    private String deptCode;
    
    /**
     * 部门层级
     */
    @TableField("level")
    private Integer level;
    
    /**
     * 排序号
     */
    @TableField("order_no")
    private Integer orderNo;
    
    /**
     * 负责人ID
     */
    @TableField("leader_id")
    private String leaderId;
    
    /**
     * 联系电话
     */
    @TableField("phone")
    private String phone;
    
    /**
     * 邮箱
     */
    @TableField("email")
    private String email;
    
    /**
     * 部门状态：0-禁用, 1-正常
     */
    @TableField("status")
    private Integer status;
    
    // ==================== 非数据库字段（用于扩展） ====================
    
    /**
     * 子部门列表（用于树形结构）
     */
    @TableField(exist = false)
    private List<Dept> children;
    
    /**
     * 部门成员数量（统计信息）
     */
    @TableField(exist = false)
    private Integer memberCount;
    
    /**
     * 子部门数量（统计信息）
     */
    @TableField(exist = false)
    private Integer childDeptCount;
    
    /**
     * 部门负责人姓名（关联查询）
     */
    @TableField(exist = false)
    private String leaderName;
    
    /**
     * 父部门名称（关联查询）
     */
    @TableField(exist = false)
    private String parentName;
    
    // ==================== Getters and Setters ====================
    
    public String getId() { 
        return id; 
    }
    
    public void setId(String id) { 
        this.id = id; 
    }
    
    public String getParentId() { 
        return parentId; 
    }
    
    public void setParentId(String parentId) { 
        this.parentId = parentId; 
    }
    
    public String getDeptName() { 
        return deptName; 
    }
    
    public void setDeptName(String deptName) { 
        this.deptName = deptName; 
    }
    
    public String getDeptCode() { 
        return deptCode; 
    }
    
    public void setDeptCode(String deptCode) { 
        this.deptCode = deptCode; 
    }
    
    public Integer getLevel() { 
        return level; 
    }
    
    public void setLevel(Integer level) { 
        this.level = level; 
    }
    
    public Integer getOrderNo() { 
        return orderNo; 
    }
    
    public void setOrderNo(Integer orderNo) { 
        this.orderNo = orderNo; 
    }
    
    public String getLeaderId() { 
        return leaderId; 
    }
    
    public void setLeaderId(String leaderId) { 
        this.leaderId = leaderId; 
    }
    
    public String getPhone() { 
        return phone; 
    }
    
    public void setPhone(String phone) { 
        this.phone = phone; 
    }
    
    public String getEmail() { 
        return email; 
    }
    
    public void setEmail(String email) { 
        this.email = email; 
    }
    
    public Integer getStatus() { 
        return status; 
    }
    
    public void setStatus(Integer status) { 
        this.status = status; 
    }
    
    public List<Dept> getChildren() {
        return children;
    }
    
    public void setChildren(List<Dept> children) {
        this.children = children;
    }
    
    public Integer getMemberCount() {
        return memberCount;
    }
    
    public void setMemberCount(Integer memberCount) {
        this.memberCount = memberCount;
    }
    
    public Integer getChildDeptCount() {
        return childDeptCount;
    }
    
    public void setChildDeptCount(Integer childDeptCount) {
        this.childDeptCount = childDeptCount;
    }
    
    public String getLeaderName() {
        return leaderName;
    }
    
    public void setLeaderName(String leaderName) {
        this.leaderName = leaderName;
    }
    
    public String getParentName() {
        return parentName;
    }
    
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    
    // ==================== ToString ====================
    
    @Override
    public String toString() {
        return "Dept{" +
                "id='" + id + '\'' +
                ", parentId='" + parentId + '\'' +
                ", deptName='" + deptName + '\'' +
                ", deptCode='" + deptCode + '\'' +
                ", level=" + level +
                ", orderNo=" + orderNo +
                ", leaderId='" + leaderId + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", status=" + status +
                ", " + super.toString() +
                '}';
    }
}